ThinkPHP5


think\cache\Driver
library\think\cache\Driver.php at line 17

Class Driver

Driver
All Known Subclasses:
think\cache\driver\File think\cache\driver\Lite think\cache\driver\Memcache think\cache\driver\Memcached think\cache\driver\Redis think\cache\driver\Sqlite think\cache\driver\Wincache think\cache\driver\Xcache

public abstract class Driver

缓存基础类


Method Summary
abstract bool

has(string name)

判断缓存是否存在

abstract mixed

get(string name, mixed default)

读取缓存

abstract boolean

set(string name, mixed value, int expire)

写入缓存

abstract false|int

inc(string name, int step)

自增缓存(针对数值缓存)

abstract false|int

dec(string name, int step)

自减缓存(针对数值缓存)

abstract boolean

rm(string name)

删除缓存

abstract boolean

clear(string tag)

清除缓存

protected string

getCacheKey(string name)

获取实际的缓存标识

mixed

pull(string name)

读取缓存并删除

$this

tag(string name, string|array keys, bool overlay)

缓存标签

protected void

setTagItem(string name)

更新标签

protected array

getTagItem(string tag)

获取标签包含的缓存标识

object

handler()

返回句柄对象,可执行其它高级方法

Method Detail

library\think\cache\Driver.php at line 29

has

public abstract bool has(string name)

判断缓存是否存在

Parameters:
name - 缓存变量名

library\think\cache\Driver.php at line 38

get

public abstract mixed get(string name, mixed default)

读取缓存

Parameters:
name - 缓存变量名
default - 默认值

library\think\cache\Driver.php at line 48

set

public abstract boolean set(string name, mixed value, int expire)

写入缓存

Parameters:
name - 缓存变量名
value - 存储数据
expire - 有效时间 0为永久

library\think\cache\Driver.php at line 57

inc

public abstract false|int inc(string name, int step)

自增缓存(针对数值缓存)

Parameters:
name - 缓存变量名
step - 步长

library\think\cache\Driver.php at line 66

dec

public abstract false|int dec(string name, int step)

自减缓存(针对数值缓存)

Parameters:
name - 缓存变量名
step - 步长

library\think\cache\Driver.php at line 74

rm

public abstract boolean rm(string name)

删除缓存

Parameters:
name - 缓存变量名

library\think\cache\Driver.php at line 82

clear

public abstract boolean clear(string tag)

清除缓存

Parameters:
tag - 标签名

library\think\cache\Driver.php at line 90

getCacheKey

protected string getCacheKey(string name)

获取实际的缓存标识

Parameters:
name - 缓存名

library\think\cache\Driver.php at line 101

pull

public mixed pull(string name)

读取缓存并删除

Parameters:
name - 缓存变量名

library\think\cache\Driver.php at line 120

tag

public $this tag(string name, string|array keys, bool overlay)

缓存标签

Parameters:
name - 标签名
keys - 缓存标识
overlay - 是否覆盖

library\think\cache\Driver.php at line 146

setTagItem

protected void setTagItem(string name)

更新标签

Parameters:
name - 缓存标识

library\think\cache\Driver.php at line 167

getTagItem

protected array getTagItem(string tag)

获取标签包含的缓存标识

Parameters:
tag - 缓存标签

library\think\cache\Driver.php at line 184

handler

public object handler()

返回句柄对象,可执行其它高级方法


ThinkPHP5